/*
 * @lc app=leetcode.cn id=507 lang=typescript
 *
 * [507] 完美数
 */

// @lc code=start
function checkPerfectNumber(num: number): boolean {
    if (num === 1) return false;
    let collection = 0;
    let now = 1;
    while (now < num) {
        if (!(num % now)) {
            collection += now;
            if (collection > num) return false;
        }
        now++;
    }
    if (collection === num) {
        return true;
    }
    return false;
}
// @lc code=end
